<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@include file="/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${ctx }/js/plugs/jquery-ui-1.10.3.custom/css/mycss/jquery-ui-1.10.3.custom.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="${ctx }/js/plugs/bootstrap-3.3.0-dist/dist/css/bootstrap.css">
<link href="${ctx }/js/plugs/font-awesome-4.2.0/css/font-awesome.css" rel="stylesheet">
<link href="${ctx }/js/plugs/jquery-ui-1.10.3.custom/css/mycss/jquery-ui-1.10.3.custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${ctx }/js/plugs/jquery-ui-1.10.3.custom/js/jquery-1.10.1.js"></script>
<script type="text/javascript" src="${ctx }/js/plugs/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.js"></script>
<script type="text/javascript" src="${ctx }/js/dw/responsive-width.js"></script>
<script language="javascript" type="text/javascript" src="${ctx }/js/plugs/My97DatePickerBeta/My97DatePicker/WdatePicker.js"></script>
<link href="${ctx }/css/dw-user.css" rel="stylesheet" type="text/css" />
<link href="${ctx }/js/plugs/font-awesome-4.2.0/css/font-awesome.css" rel="stylesheet">

<title>用户选择</title>
<script type="text/javascript">
	
$(document).ready(function(){
	currentMenu("groupmanager");
	$(".checkboxAll").unbind();
	$(".checkboxAll").change(function(){
		if($(this).prop("checked")){
			$(".quItemCheckbox").prop("checked",true);
		}else{
			$(".quItemCheckbox").prop("checked",false);
		}
	});
	
	$(".quItemCheckbox").change(function(){
		var noCheckeds=$(".quItemCheckbox").not(":checked");
		if(noCheckeds[0]){
			$(".checkboxAll").prop("checked",false);
		}else{
			$(".checkboxAll").prop("checked",true);
		}
	});

	$('#saveBtn').bind("click",function() {
	    obj = document.getElementsByName("userId");
	    check_val = [];
	    for(k in obj){
	        if(obj[k].checked)
	            check_val.push(obj[k].value);
	    }
	    
	    var userIds = check_val.join('#');
	    $("#userSelected").val(userIds);
	    $("#userGroupId").val($("#groupId").val());
	    $("#userAdd").submit();
	});
	

});

window.onbeforeunload = function() {  
	window.opener.location.reload(); 
};

</script>
<style type="text/css">
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default{
	background: #EFEFEF;
}
.usGroupUl{
	list-style: none;
	padding: 5px;
}
.usGroupUl li{
	list-style: none;
	font-size: 14px;
}
.usGroupUl li a{
	color: #333;
}
.new-dialog .ui-dialog-buttonset button{
	padding: 5px 10px;
}
</style>
</head>
<body>
	<div style="clear: both;"></div>
	<div id="dwBody" style="margin-top: 15px;" >
		<div id="dwBodyContent" class="bodyCenter" style="">
		<div id="dwBodyUser">
			<div class="surveyCollectMiddle">
				
				<div class="surveyCollectMiddleContent">
					<div style="padding: 25px 45px;overflow: auto;padding-top: 12px;">
							<div style="padding: 5px;color: #666565;letter-spacing: 2px;font-size: 18px;">选择用户</div>
							
							<div class="contacts_search" style="padding: 5px;color:#666565;margin-top: 15px;" >
								<form id="formSearch" action="${ctx }/sy/group/group-admin-sub/user-list.do" method="post">
								<div style="padding-left: 30px;padding-top: 8px;padding-bottom: 8px;">
										<span style="font-size: 14px;vertical-align: middle;">状态&nbsp;</span>
										<select name="status" style="vertical-align: middle;">
											<option value="">不限</option>
											<option value="1">可用</option>
											<option value="0">禁用</option>
										</select>&nbsp;&nbsp;
									<span style="font-size: 14px;vertical-align: middle;">学号&nbsp;</span>
									<input type="text"  name="studentId" value="${studentId }" class="inputS1"/>&nbsp;&nbsp;
									<input type="hidden"  name="groupId" value="${groupId }" id="groupId"/>
									<input type="submit" value="查询" class="sbtn25 sbtn25_1" style="font-size: 16px;"/>
									</div>
								</div>
								</form>
								
							</div>
							
							<div style="margin-top: 15px;">
							
								
								<div>
									<table class="contacts-table"  cellpadding="0" cellspacing="0" width="100%">
									<tr>
										<th style="text-align: center;" width="30"><input type="checkbox" class="checkboxAll"></th>
										<th align="left">学号</th>
										<th align="left">姓名</th>
										<th align="left">学校</th>
										<th align="left">学院</th>
										<th align="left">专业</th>
										<th align="left">邮箱</th>
										<th align="left">手机</th>
										<th align="left">性别</th>
										<th align="left">省份</th>
										<th align="left">入学时间</th>
									</tr>

										<c:choose>
											<c:when test="${page.totalItems > 0}">

												<c:forEach items="${page.result }" var="en">
													<tr>
														<td align="center"><input type="checkbox" class="quItemCheckbox" value="${en.id }" name="userId"></td>
																				<td align="left">${en.studentId }</td>
										<td align="left">${en.name }</td>
										<td align="left">${en.school }</td>
										<td align="left">${en.college }</td>
										<td align="left">${en.major }</td>

										<td align="left">${en.email }</td>
										<td align="left">${en.cellphone }</td>
										<c:if test="${en.sex == 0 }">
										<td align="left">男</td>
										</c:if>
										<c:if test="${en.sex != 0 }">
										<td align="left">女</td>
										</c:if>
										<td align="left">${en.province }</td>
										<td align="left"><fmt:formatDate value="${en.enrollmentTime }" pattern="yyyy年MM月dd日"/></td>
													</tr>
												</c:forEach>

											</c:when>
											<c:otherwise>
												<tr>
													<td colspan="11">

														<div style="padding: 60px;font-size: 22px;text-align: center;color: #b1aeae;">还没有数据！</div>

													</td>
												</tr>
											</c:otherwise>
										</c:choose>

								</table>
								
								<div style="padding-top: 15px;text-align: center;">
									<div class="btn-group">
										<c:if test="${page.pageNo > 1}">
											<a href="${ctx }/sy/group/group-admin-sub/user-list.do?pageNo=${page.pageNo-1}" class="btn btn-default pageIndex">&lt;</a>
										</c:if>
										<c:if test="${page.startpage > 1}">
											<a href="${ctx }/sy/group/group-admin-sub/user-list.do?pageNo=1" class="btn btn-default pageIndex">1</a>
											<c:if test="${page.startpage > 2 }">
												<%--<span>...</span>--%>
											</c:if>
										</c:if>
										<c:forEach begin="${page.startpage }" end="${page.endpage }" var="en">
											<c:choose>
												<c:when test="${page.pageNo eq en }"><a href="${ctx }/sy/group/group-admin-sub/user-list.do?pageNo=${en }" class="btn btn-default pageIndex" style="background: #D3DEED;">${en }</a></c:when>
												<c:otherwise><a href="${ctx }/sy/group/group-admin-sub/user-list.do?pageNo=${en}" class="btn btn-default pageIndex">${en }</a></c:otherwise>
											</c:choose>
										</c:forEach>
										<c:if test="${page.totalPage > (page.endpage)}">
											<c:if test="${page.totalPage > (page.endpage+1)}">
												<%--<span>...</span>--%>
											</c:if>
											<a href="${ctx }/sy/group/group-admin-sub/user-list.do?pageNo=${page.totalPage}" class="btn btn-default pageIndex">${page.totalPage }</a>
										</c:if>
										<c:if test="${page.totalPage > page.pageNo}">
											<a href="${ctx }/sy/group/group-admin-sub/user-list.do?pageNo=${page.pageNo+1}" class="btn btn-default pageIndex">&gt;</a>
										</c:if>
										
									</div>
									<c:if test="${page.totalItems > 0}">
									&nbsp;&nbsp;&nbsp;&nbsp;
									<input id="jumpPageNo" type="number" value='${page.pageNo}' min=1 max=${page.totalPage } style="padding: 4px;outline: none;border: 1px solid #83ABCB;width:60px">
									<a id ="jumpHref" href="javascript:void(0)" onclick='jumpPage()'  class="btn btn-default pageIndex" hidefocus="true" style="padding: 4px;margin-bottom: 4px;">GO</a>
									<script>
									function jumpPage(){
									var min = 1;
									var max = ${page.totalPage };
									var jumpNo = document.getElementById("jumpPageNo").value;
										if (jumpNo <= max && jumpNo >=min) {
											var a = document.getElementById("jumpHref"); 
											a.href = '${ctx }/sy/group/group-admin-sub/user-list.do?pageNo='+jumpNo;
											$("#formSearch").attr("action",$("#jumpHref").attr("href"));
											$("#formSearch").submit();
										} else {
											document.getElementById("jumpPageNo").value ='';
											return false;
										}
									}
									</script>
									</c:if>
								</div>
								
								</div>
								
							</div>
							</div>
						<div class="contacts_search" style="padding: 5px;color:#666565;margin-top: 15px;" >
								<form id="" action="#" method="post">
								<div style="padding-left: 30px;padding-top: 8px;padding-bottom: 8px;">
								<input type="hidden" name="ctx" value=${ctx } id="ctx">
								<input type="hidden" name="surveyId" value=${surveyId } id="surveyId">
	 								<button type="button" class="btn btn-default" id="saveBtn">保存</button>
	
									<div style="padding: 5px;color: #666565;text-align: right;float: right;margin-right: 20px;">
									</div>
								</div>
								</form>
								
						</div>
					</div>
					
				</div>
			</div>
			
		</div>
		</div>
	</div>

<form id="userAdd" action="${ctx }/sy/group/group-admin-sub/user-add.do" method="post">
<input type="hidden" name="userSelected" id="userSelected"/>
<input type="hidden" name="userGroupId" id="userGroupId"/>
</form>
	
	
<script type="text/javascript">

$("select[name='status']").val("${status}");

resizeBodyWidth();
$("a").attr("hidefocus",true);

</script>
</body>
</html>
